package com.laoxu.java.ms.controller;

import com.laoxu.java.ms.model.User;
import com.laoxu.java.ms.service.UserClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author laoxu
 * @Date 2022/12/16 16:09
 * @Desc 用户接口
 */
@RestController
@RequestMapping("/userapi")
public class UserController {
    @Autowired
    UserClient userClient;

    @GetMapping("/users")
    public List<User> getUsers(){
        return userClient.getUsers();
    }

    @GetMapping("/user/{id}")
    public User getUserById(@PathVariable("id") Integer id){
        return userClient.getUserById(id);
    }
}
